package c.e.b.h.e.k;

import c.e.b.h.e.b;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;

/* compiled from: ExecutorUtils */
public class p0 extends d {
    public final /* synthetic */ String a;
    public final /* synthetic */ ExecutorService b;
    public final /* synthetic */ long c;
    public final /* synthetic */ TimeUnit d;

    public p0(String str, ExecutorService executorService, long j, TimeUnit timeUnit) {
        this.a = str;
        this.b = executorService;
        this.c = j;
        this.d = timeUnit;
    }

    public void a() {
        b bVar = b.a;
        try {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("Executing shutdown hook for ");
            stringBuilder.append(this.a);
            bVar.b(stringBuilder.toString());
            this.b.shutdown();
            if (!this.b.awaitTermination(this.c, this.d)) {
                stringBuilder = new StringBuilder();
                stringBuilder.append(this.a);
                stringBuilder.append(" did not shut down in the allocated time. Requesting immediate shutdown.");
                bVar.b(stringBuilder.toString());
                this.b.shutdownNow();
            }
        } catch (InterruptedException unused) {
            bVar.b(String.format(Locale.US, "Interrupted while waiting for %s to shut down. Requesting immediate shutdown.", new Object[]{this.a}));
            this.b.shutdownNow();
        }
    }
}
